package oj_kickstart;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class WiggleWalk {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        for (int t = 0; t < T; t++) {
            int N = sc.nextInt();
            int R = sc.nextInt();
            int C = sc.nextInt();
            int SR = sc.nextInt();
            int SC = sc.nextInt();
            Map<String, Boolean> grid = new HashMap<>();
            grid.put(SR + " " + SC, Boolean.TRUE);
            String directions = sc.next();
            for (int n = 0; n < N; n++) {
                char direction = directions.charAt(n);
                // find the target position
                switch (direction) {
                    case 'E':
                        while (grid.containsKey(SR + " " + ++SC)) {
                        }
                        break;
                    case 'S':
                        while (grid.containsKey(++SR + " " + SC)) {
                        }
                        break;
                    case 'W':
                        while (grid.containsKey(SR + " " + --SC)) {
                        }
                        break;
                    case 'N':
                        while (grid.containsKey(--SR + " " + SC)) {
                        }
                        break;
                }
                grid.put(SR + " " + SC, Boolean.TRUE);
            }
            System.out.println(String.format("Case #%d: %d %d", t + 1, SR, SC));
        }
    }


}
